Skip to content

Branch Distances in SearchBasedFuzzer is wrong#185

Open
hycinth22 wants to merge 1 commit intouds-se:masterfrom
hycinth22:patch-1
Open

Branch Distances in SearchBasedFuzzer is wrong#185
hycinth22 wants to merge 1 commit intouds-se:masterfrom
hycinth22:patch-1

Conversation

@hycinth22
Copy link

@hycinth22 hycinth22 commented Apr 7, 2025

I believe last 3 lines in the table is wrong

    "| Condition | Distance True | Distance False |\n",
    "| ------------- |:-------------:| -----:|\n",
    "| a == b      | abs(a - b) | 1 |\n",
    "| a != b      | 1          | abs(a - b) |\n",
    "| a < b       | b - a + 1  | a - b      |\n",
    "| a <= b      | b - a      | a - b + 1  |\n",
    "| a > b       | a - b + 1  | b - a      |\n",

for example,
to make a<b true, we want estimate the distance betweern unstatisfied inputs and the closest statisfied inputs.
for unstatisfied inputs, a>=b . so, the distance true should be a - b + 1 instead of b - a + 1

similarly, the distance false should be b - a instead of a - b

fixed:

    "| Condition | Distance True | Distance False |\n",
    "| ------------- |:-------------:| -----:|\n",
    "| a == b      | abs(a - b) | 1 |\n",
    "| a != b      | 1          | abs(a - b) |\n",
    "| a < b       | a - b + 1  | b - a      |\n",
    "| a <= b      | a - b      | b - a + 1  |\n",
    "| a > b       | b - a + 1  | a - b      |\n",

fix Branch Distances
@hycinth22
Copy link
Author

hycinth22 commented Apr 7, 2025

The following code is right so no need to fix.

" elif op == \"Lt\":\n",
" if lhs < rhs:\n",
" distance_false = rhs - lhs\n",
" else:\n",
" distance_true = lhs - rhs + 1\n",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant